from pydantic import BaseModel
from typing import Optional
from app.models.user import UserType

class UserBase(BaseModel):
    username: str
    nickname: Optional[str] = None
    avatar: Optional[str] = None

class UserCreate(UserBase):
    password: str

class UserLogin(BaseModel):
    username: str
    password: str

class WechatLogin(BaseModel):
    code: str

class Token(BaseModel):
    access_token: str
    token_type: str = "bearer"

class TokenData(BaseModel):
    username: str
    user_type: UserType
    permission_level: int

class User(UserBase):
    id: int
    user_type: UserType
    permission_level: int
    is_active: bool

    class Config:
        from_attributes = True 